\section{Attitude determination}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Attitude sensors}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}[t]{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
1. Sun-sensors \\
\vfill
The two major types of sun-sensors are:
\begin{enumerate}
    \item analog sun-sensors
    \item digital sun-sensors
    \begin{itemize}
        \item[\mysquare] accurate, expensive
    \end{itemize}
\end{enumerate}
\vfill
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Analog sun-sensors
\begin{columns}
\column{0.45\textwidth}
\begin{center}\includegraphics[scale=0.4]{fig_9_1.jpg}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.1:} Sun sensor\end{center}
\column{0.45\textwidth}
\begin{center}\includegraphics{fig_9_2.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.2:} Analog sun-sensor\end{center}
\end{columns}
\vspace{10pt}
Analog sun-sensors are essentially solar cells, whose current output \( i \) is proportional to the cosine of the angle $\theta$ between the sensor normal $\hat{\vec n}$ and the incident solar radiation \(\hat{\vec s}\).  
\[i(\theta) = i(0) \cos \theta\]
where \( i(0) \) is the sensor output when the sun-direction is parallel to the sensor normal.
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
In any case, an analog sun-sensor provides the angle \(\theta\) of the sun-vector relative to the sensor normal, and as such, it provides a cone \(\mathcal C_s\) on which the sun-vector must lie.
\begin{center}\includegraphics{fig_9_3.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.3:} Sun-cone provide by an analog sun-sensor\end{center}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Combinations of analog sun-sensors (with different sensor normals) can be used to determine more information about the sun vector. \\
\vspace{12pt}
For example, a pair of analog sun-sensors yield a pair of cones on which the sun-vector must lie.
\begin{center}\includegraphics{fig_9_4.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.4:} Possible sun-vectors from a pair of analog sun-sensors\end{center}
\end{frame}

\begin{frame}[t]{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Digital sun-sensors
\vspace{12pt}
\begin{itemize}
    \item Digital sun-sensors are significantly more complex than analog sun-sensors, however, they are far more accurate.
    \item A two-axis type digital sun-sensor can provide a full sun-vector in sensor coordinates.
    \item Using knowledge of the sensor orientation relative to the spacecraft body frame, the sun-vector can be readily transformed to the body-frame.
\end{itemize}
\begin{center}\includegraphics[scale=0.8]{fig_9_5.jpg}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.5:} Sun sensor\end{center}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{block}{Sensor limitations}
\begin{itemize}\setlength{\itemsep}{10pt}
    \item Both analog and digital sun-sensors have limited useful fields of view, so multiple sensors may be needed to give the required coverage.
    \item Additional, for digital sun-sensors, there may be spacecraft body-rate limitations outside of which the sensor ceases to be useful.
\end{itemize}
\end{block}
\end{frame}

\begin{frame}[t]{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
2. Three-axis magnetometers
\vfill
\begin{itemize}
\item A three-axis magnetometer measures the local magnetic field vector in sensor coordinates.
    \begin{itemize} 
    \item[\mysquare] Magnetometers are relatively inaccurate.
    \item[\mysquare] However, they do not have the field of view limitations inherent to sun-sensors,
        earth-sensors, and star-trackers.
    \item[\mysquare] Therefore, they are very useful for initial attitude determination and initial acquisition
        before the other more accurate measurements become available.
    \end{itemize}
\end{itemize}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{block}{Sensor limitations}
\begin{itemize}
    \item A magnetometer measures the local magnetic field vector. However, this is only useful for the purposes of spacecraft attitude determination and control if the measured magnetic field consists mainly of the Earth’s magnetic field.
    \item For this reason, magnetometer placement within the spacecraft becomes critical, so as to minimize the corruption of measurements by the spacecraft’s own magnetic field due to ferro-magnetic materials (in the spacecraft structure) and spacecraft current loops (in the spacecraft electronics).
    \item Some (but not all) of these effects can be removed by calibration.
    \item For this reason, magnetometers are sometimes mounted on booms outside of the main spacecraft body.
    \item Additional measures are needed if magnetometers are used in conjunction with magnetic torquers so as to ensure that the magnetic torquers do ont influence the magnetometer readings.
\end{itemize}
\end{block}
\end{frame}

\begin{frame}[t]{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
3. Earth sensors
\vfill
\begin{itemize}
\item Earth sensors can be used to measure the nadir vector.
    \begin{itemize}
    \item[\mysquare] That is, they measure the unit vector pointing
        from the spacecraft toward the Earth’s center of mass.
    \end{itemize}
\end{itemize}
\vspace{12pt}
\begin{block}{Sensor limitations}
Earth sensors are only useful if the Earth lies within the sensor field of view.
\end{block}
\end{frame}

\begin{frame}[t]{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
4. Star trackers \\
\vfill
Star trackers can lock on, identify and track a star. \\
\begin{itemize}
    \item Star provide the most accurate reference for attitude determination. There are two reasons for this.
\begin{itemize}
    \item [\scalebox{0.6}{$\blacksquare$}] First of all, stars appear very small (compare the apparent size of a star to the apparent size of the sun or Earth). As such, the direction of a star can be measured very accurately.
    \item [\scalebox{0.6}{$\blacksquare$}] Second, stars are inertially fixed objects.
\end{itemize}
\end{itemize}
Most modern star trackers can be considered to be full three-axis attitude sensors.
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{block}{Sensor limitations}
\begin{itemize}
    \item First of all, the sun and the Earth must not enter the star tracker’s field of view. This limits the allowable spacecraft attitude.
    \item Additionally, there are typically quite severe spacecraft body-rate limitations if a star tracker is to be used without further compensation for the spacecraft motion.
    \begin{itemize}
        \item [\scalebox{0.6}{$\blacksquare$}] For this reason, star trackers are typically used on three-axis stabilized spacecraft (as opposed to spinning spacecraft).
    \end{itemize}
\end{itemize}
\end{block}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{block}{Sensor limitations}
\begin{itemize}
    \item Star trackers are generally designed for specific mission requirements.
    \begin{itemize}
        \item [\scalebox{0.6}{$\blacksquare$}] For example, star trackers typically have a very limited instantaneous field of view.
        \item [\scalebox{0.6}{$\blacksquare$}] In order to determine the attitude to within requirements, it will need to have at least two stars within the instantaneous field of view at any one time (if not more).
        \item [\scalebox{0.6}{$\blacksquare$}] If the star tracker is required for a large range of attitudes, the number of stars stored in the on-board star catalog can become very large, possibly in thousands.
    \end{itemize}
    \item Finally, given the significant computational load associated with identifying, locking on and tracking multiple stars, there may be a noticeable time-delay in the star tracker output, which needs to be compensated for in the spacecraft attitude control algorithms.
\end{itemize}
\end{block}
\end{frame}

\begin{frame}[t]{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
5. Rate sensors \\
\vfill
Rate sensors provide measurements of the spacecraft body rate. \\
\vspace{12pt}

There are a number of different kinds of rate sensor.
\begin{itemize}
    \item Traditionally, rate sensors incorporated mechanical gyros.
    \begin{itemize}
        \item [\scalebox{0.6}{$\blacksquare$}] The drawback of this is that it requires moving mechanical parts, which limits the sensor lifetime.
    \end{itemize}
    \item Recently, rate sensors such as laser gyros have been developed based on different principle.
    \begin{itemize}
        \item [\scalebox{0.6}{$\blacksquare$}] Require no moving parts.
    \end{itemize}
\end{itemize}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{block}{Sensor limitations}
All rate sensors have an inherent bias. That is, the measured body rate has some small but nearly constant offset (in addition to the measurement noise).
\begin{itemize}
    \item Often, rate sensors measurements are fused together with other attitude sensor measurement in an EKF (Extended Kalman Filter) to provide estimates of the spacecraft body rate.
\end{itemize}
\end{block}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The Kalman filter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{itemize} \setlength{\itemsep}{10pt} 
    \item Because all sensors, such as sun sensors, rate gyros, and others, provide imperfect measurements that are corrupted by noise.
    \item The spacecraft attitude must be estimated.
    \item The filtering techniques developed here can be adapted for the orbit estimation problem also.
\end{itemize}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{block}{The Kalman filter}
    Given the measurement \( y_k \), we can have estimation \(\hat{x}_k\).  
\end{block}
\vspace{10pt}
\textcolor{blue}{System:}
\begin{align*}
& x_k = F_{k-1}x_{k-1} + G_{k-1}u_{k-1} + L_{k-1}w_{k-1} \\
& y_k = H_kx_k + M_kv_k \\
& w_k \sim \mathcal{N}(0, Q_k) \\
& v_k \sim \mathcal{N}(0, R_k) \\
& E[w_kv_k^T] = 0
\end{align*}
\textcolor{blue}{Initialization:}
\begin{align*}
& \hat{x}_0 = E[x_0] \\
& P_0 = E[(x_0 - \hat{x}_0)(x_0 - \hat{x}_0)^T] \\
\end{align*}
\end{frame}

\begin{frame}[t]{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\vspace{-12pt}
\begin{block}{The Kalman filter}
    Given the measurement \( y_k \), we can have estimation \(\hat{x}_k\).  
\end{block}
\vspace{-4pt}
\begin{description}
\item[Prediction:]
The system state is predicted given the previous estimate of the state along with a model of the system.
\begin{align*}
\hat{x}_k^- =& F_{k-1}\hat{x}_{k-1} + G_{k-1}u_{k-1} \\
\hat{y}_k^- =& H_k\hat{x}_k^- \\
P_k^- =& F_{k-1}P_{k-1}F_{k-1}^T + L_{k-1}Q_{k-1}L_{k-1}^T
\end{align*}
\item[Correction:]
The state estimate \(\hat{x}_k\) is corrected using the measurements \(y_k\) that become available.  
\begin{align*}
W_k =& H_kP_k^-H_k^T + M_kR_kM_k^T \\
K_k =& P_k^-H_k^TW_k^{-1} \\
\hat{x}_k =& \hat{x}_k^- + K_k(y_k - \hat{y}_k^-) \\
P_k =& P_k^- - K_kH_kP_k^- - P_k^-H_k^TK_k^T + K_kW_kK_k^T
\end{align*}
\end{description}
\end{frame}
